package top.lixunda.ecommerce.server.user.api.entity.dto;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.google.common.collect.ImmutableMap;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import top.lixunda.ecommerce.server.business.api.condition.ILambdaQueryWrapperDTO;
import top.lixunda.ecommerce.server.business.api.entity.dto.OrderByDTO;
import top.lixunda.ecommerce.server.user.api.entity.db.RoleDO;

import java.util.Map;

/**
 * 角色查询DTO
 *
 * @author lixunda
 * @version time:2020/4/26 13:53
 */
@ApiModel("角色查询DTO")
@Data
@EqualsAndHashCode(callSuper = true)
public class RoleQueryDTO extends OrderByDTO implements ILambdaQueryWrapperDTO<RoleDO> {


    private static final Map<String, SFunction<RoleDO, ?>> COLUMNS =
            new ImmutableMap.Builder<String, SFunction<RoleDO, ?>>()
                    .build();


    /**
     * 将当前用于查询的DTO中的查询数据转换为 LambdaQuerySqlWrapper
     *
     * @return 条件构造器 LambdaQuerySqlWrapper
     */
    @Override
    public LambdaQueryWrapper<RoleDO> toWrapper() {
        LambdaQueryWrapper<RoleDO> wrapper = new LambdaQueryWrapper<>();
        dealWithOrderBy(wrapper, COLUMNS);
        return wrapper;
    }
}
